home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_lag_grid2.cog < prev    next >
Text File  |  1999-11-15  |  10KB  |  321 lines

  1. # Jones 3D Cog Script
  2. #
  3. # BAB_Courtyard_Grid_1.cog
  4. # A waypoint grid for the sharks in LAG, designed to keep sharks 'patrolling' in desired areas
  5. # As well as monitoring the shark population and adding a new shark if necessary.
  6. #
  7. # [JM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ========================================================================================
  12.  
  13. symbols                                     
  14.  
  15. message     startup
  16. message     killed
  17. message     entered
  18. message     arrived
  19.  
  20. # ============================== SUBROUTINES ==============================
  21.  
  22. flex        LinkWpnts           local
  23.  
  24.  
  25. # ========================================================================================
  26. #  GHOST OBJECTS - THE GRID
  27.  
  28. thing       wpnt00
  29. thing       wpnt01
  30. thing       wpnt02
  31. thing       wpnt03
  32. thing       wpnt04
  33. thing       wpnt05
  34. thing       wpnt06
  35. thing       wpnt07
  36. thing       wpnt08
  37. thing       wpnt09
  38. thing       wpnt10
  39. thing       wpnt11
  40. thing       wpnt12
  41. thing       wpnt13
  42. thing       wpnt14
  43. thing       wpnt15
  44. thing       wpnt16
  45. thing       wpnt17
  46. thing       wpnt18
  47. thing       wpnt19
  48. thing       wpnt20
  49. thing       wpnt21
  50. thing       wpnt22
  51. thing       wpnt23
  52. thing       wpnt24
  53. thing       wpnt25
  54. thing       wpnt26
  55. thing       wpnt27
  56. thing       wpnt28
  57. thing       wpnt29
  58. thing       wpnt30
  59. thing       wpnt31
  60. thing       wpnt32
  61. thing       wpnt33
  62. thing       wpnt34
  63. thing       wpnt35
  64. thing       wpnt36
  65.  
  66. #  SHARKS - and anything else that might need to use the grid
  67.  
  68. thing       Shark00                     LinkID=1
  69. thing       Shark01                     LinkID=1
  70. thing       Shark02                     LinkID=1
  71. thing       Shark03                     LinkID=2
  72. thing       Shark04                     LinkID=2    
  73. thing       Shark05                     #LinkID=0    The Shark inside the Bronze Door room
  74.  
  75.  
  76. #  TRIGGERS - To put one extra shark in if others have been killed...
  77. sector     SectorTrigger00              LinkID=3
  78. sector     SectorTrigger01              LinkID=3
  79. sector     SectorTrigger02              LinkId=3
  80. sector     SectorTrigger03              LinkID=3
  81. sector     SectorTrigger04              LinkID=3
  82. sector     SectorTrigger05              LinkID=3
  83. sector     SectorTrigger06              LinkID=3
  84. sector     SectorTrigger07              LinkID=3
  85.  
  86. #thing       BronzeDoor1
  87. #thing       BronzeDoor2
  88.  
  89. thing       GhostSharkOuter             #For the placement of new sharks
  90. thing       GhostSharkInner                          
  91.  
  92. #thing       BronzeDoorOne
  93. #thing       BronzeDoortwo
  94.  
  95.  
  96. #  LOCAL VARIABLES
  97.  
  98. template    SharkTPL=shark              local
  99.  
  100. thing       NewSharkOuter0=-1           local
  101. thing       NewSharkOuter1=-1           local
  102. thing       NewSharkInner0=-1           local
  103. thing       NewSharkInner1=-1           local
  104.  
  105. int         InnerPopulation=3           local       # Many variables (probably too many) for managing the inner and outer shark populations...
  106. int         OuterPopulation=2           local
  107. int         MinPopulation=2             local
  108.  
  109. int         NumberOfWpnts=37            local
  110. int         NumberOfSharks=6            local       # Initial number of sharks in the world
  111.  
  112. int         Check0=0                    local
  113. int         Check1=0                    local
  114.  
  115. int         GenCounter                  local
  116.  
  117. end
  118. # ========================================================================================
  119. # ========================================================================================
  120.  
  121. code
  122. # ========================================================================================
  123.  
  124. startup:
  125.     
  126.     #  ASSIGNMENT OF GHOST OBJECTS TO WAYPOINT SLOTS        
  127.     
  128.     for(GenCounter = 0; GenCounter < NumberOfWpnts; GenCounter = GenCounter + 1)
  129.     {
  130.         AISetWpnt(wpnt00[GenCounter], GenCounter);
  131.     }
  132.     
  133.     #  LINK WAYPOINTS
  134.     
  135.     AIConnectWpnts(0, 1);
  136.     AIConnectWpnts(0, 3);
  137.     AIConnectWpnts(0, 2);
  138.     AIConnectWpnts(1, 6);
  139.     AIConnectWpnts(1, 2);
  140.     AIConnectWpnts(2, 6);
  141.     AIConnectWpnts(2, 4);
  142.     AIConnectWpnts(2, 5);
  143.     AIConnectWpnts(3, 4);
  144.     AIConnectWpnts(4, 5);
  145.     
  146.     AIConnectWpnts(4, 12);
  147.     
  148.     AIConnectWpnts(5, 6);
  149.     
  150.     AIConnectWpnts(7, 8);
  151.     AIConnectWpnts(8, 9);
  152.     AIConnectWpnts(8, 10);
  153.     AIConnectWpnts(9, 10);
  154.     AIConnectWpnts(9, 11);
  155.     AIConnectWpnts(10, 11);
  156.     
  157.     AIConnectWpnts(13, 14);
  158.     AIConnectWpnts(13, 15);
  159.     AIConnectWpnts(14, 16);
  160.     AIConnectWpnts(14, 17);
  161.     AIConnectWpnts(15, 16);
  162.     AIConnectWpnts(15, 17);
  163.     
  164.     AIConnectWpnts(18, 19);
  165.     AIConnectWpnts(18, 21);
  166.     AIConnectWpnts(19, 20);
  167.     AIConnectWpnts(19, 23);
  168.     AIConnectWpnts(20, 21);
  169.     AIConnectWpnts(21, 22);
  170.     AIConnectWpnts(22, 23);
  171.     
  172.     AIConnectWpnts(24, 25);
  173.     AIConnectWpnts(24, 26);
  174.     AIConnectWpnts(24, 27);
  175.     AIConnectWpnts(25, 29);
  176.     AIConnectWpnts(26, 27);
  177.     AIConnectWpnts(26, 28);
  178.     AIConnectWpnts(27, 29);
  179.     AIConnectWpnts(27, 28);
  180.     AIConnectWpnts(28, 29);
  181.    
  182.     AIConnectWpnts(31, 32);
  183.     AIConnectWpnts(31, 33);
  184.     AIConnectWpnts(31, 34);
  185.     AIConnectWpnts(32, 33);
  186.     AIConnectWpnts(33, 35);
  187.     AIConnectWpnts(34, 35);
  188.     
  189.     for(GenCounter = 0; GenCounter < NumberOfSharks; GenCounter = GenCounter + 1)
  190.     {
  191.         #  Set instincts for the sharks and let them roam
  192.         AISetInstinctWpntMode(Shark00[GenCounter]);
  193.         AIEnableInstinct(Shark00[GenCounter], "roam", 1);
  194.     }
  195.   
  196.     return;
  197.     
  198. # ========================================================================================
  199. killed:
  200.     
  201.     #  Keep track of dead sharks
  202.     if(GetSenderID() == 1)
  203.     { 
  204.         
  205.         InnerPopulation = InnerPopulation - 1;
  206.         
  207.         if(Check0 == 0);
  208.         {
  209.             Check0 = 1;
  210.             
  211.             AIConnectWpnts(17, 18);            
  212.             AIConnectWpnts(23, 24);
  213.             
  214.         }
  215.         return;
  216.     }
  217.     
  218.     if(GetSenderID() == 2)
  219.     {
  220.         OuterPopulation = OuterPopulation - 1;
  221.        
  222.         if(Check1 == 0)
  223.         {
  224.             Check1 = 1;
  225.             
  226.             AIConnectWpnts(5, 7);
  227.             AIConnectWpnts(5, 8);
  228.             AIConnectWpnts(5, 9);
  229.             AICOnnectWpnts(6, 7);
  230.         }
  231.         return;
  232.     }
  233.  
  234.     for(GenCounter = 0; GenCounter < 1; GenCounter = GenCounter + 1)
  235.     {
  236.         if(GetSenderRef() == NewSharkInner0[GenCounter])
  237.         {
  238.             NewSharkInner0[GenCounter] = -1;
  239.             InnerPopulation = InnerPopulation - 1;
  240.         }
  241.         else if(GetSenderRef() == NewSharkOuter0[GenCounter])
  242.         {  
  243.                 NewSharkOuter0[GenCounter] = -1;
  244.                 OuterPopulation = OuterPopulation - 1;
  245.         }
  246.         
  247.     }
  248.    
  249.     return;
  250.  
  251. # ========================================================================================
  252. entered:
  253.     #  Check for low shark population where Indy can't see any sharks being generated
  254.     #  This is the sloppy maddness for making sure that there are always 2 sharks in the inner lagoon area, as well as the outer area
  255.     if(GetSenderID() == 3)
  256.     {
  257.         if(OuterPopulation < MinPopulation)
  258.         {
  259.             for(GenCounter = 0; GenCounter < 2; GenCounter = GenCounter + 1)
  260.             {
  261.             
  262.                 if(NewSharkOuter0[GenCounter] == -1)    #Create a shark in the outer lagoon
  263.                 {   
  264.                     NewSharkOuter0[GenCounter] = CreateThing(SharkTPL, GhostSharkOuter);
  265.                     CaptureThing(NewSharkOuter0[GenCounter]);
  266.              
  267.                     AISetInstinctWpntMode(NewSharkOuter0[GenCounter]);
  268.                     AIEnableInstinct(NewSharkOuter0[GenCounter], "roam", 1);
  269.                   
  270.                     OuterPopulation = OuterPopulation + 1;
  271.                     
  272.                     return;
  273.                  }
  274.             }
  275.         }
  276.         
  277.         if(InnerPopulation < MinPopulation)
  278.         {
  279.             for(GenCounter = 0; GenCounter < 2; GenCounter = GenCounter + 1) 
  280.             {
  281.                 if(NewSharkInner0[GenCounter] == -1)        #Create a shark in the inner lagoon
  282.                 {
  283.                     NewSharkInner0[GenCounter] = CreateThing(SharkTPL, GhostSharkInner);
  284.                     CaptureThing(NewSharkInner0[GenCounter]);
  285.                 
  286.                     AISetInstinctWpntMode(NewSharkInner0[GenCounter]);
  287.                     AIEnableInstinct(NewSharkInner0[GenCounter], "roam", 1);
  288.                     
  289.                     InnerPopulation = InnerPopulation + 1;
  290.                     
  291.                     return;
  292.                 }
  293.             }
  294.         }
  295.     }
  296.     
  297.     return;
  298.     
  299. # ========================================================================================
  300. // arrived:
  301.  
  302. //    if(GetSenderRef() == BronzeDoorOne)
  303. //    {   
  304. //        AIConnectWpnts(29, 30);     #These three connections are not accessible until certain 'doors' have been opened, the sharks should just turn around
  305. //        AIConnectWpnts(30, 31);
  306. //    }
  307.     
  308. //    else if(GetSenderRef() == BronzeDoorTwo)
  309. //    {
  310. //        AIConnectWpnts(35, 36);
  311. //    }        
  312.         
  313.                 
  314.  
  315. //    return;
  316.  
  317. # ========================================================================================
  318.  
  319. end   
  320.